package com.devicemantra.coordinate.operations;
import com.devicemantra.coordinate.dataobjects.*;

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.jdo.PersistenceManager;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.*;

import org.apache.commons.fileupload.FileItemIterator;
import org.apache.commons.fileupload.FileItemStream;
import org.apache.commons.fileupload.FileUploadBase.SizeLimitExceededException;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.io.IOUtils;

import com.devicemantra.coordinate.dataobjects.CDepartmentFactory;
import com.devicemantra.coordinate.exceptions.operations.CException;
import com.devicemantra.coordinate.exceptions.operations.COperationNotImplementedException;
import com.devicemantra.coordinate.interfaces.http.CMultipartFormReader;
import com.devicemantra.coordinate.jaxb.OperationType;
import com.google.appengine.api.datastore.Blob;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;
import com.oreilly.servlet.*;
import com.oreilly.servlet.multipart.*;

/* Testing O'Reily Multipart form-data upload */

public class TestAddDepartment extends HttpServlet 
{
	
	public void doPost(HttpServletRequest req, HttpServletResponse resp)
	throws IOException 
	{
		COperation lOperation = null;
		try {
			lOperation = COperationFactory.getServiceImpl(OperationType.ADD_DEPARTMENT);
		} catch (COperationNotImplementedException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		
		}
		try {
			lOperation.processEvent(req,resp);
		} catch (CException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			lOperation.sendResponse();
		} catch (CException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
		
		
		
	}
